#ifndef GameServer_h__
#define GameServer_h__

#include "Common.h"
#include "boost/enable_shared_from_this.hpp"

#include "JME_TcpSession.h"
#include "JME_NetHandler.h"
#include "JME_Dispatcher.h"
#include "JME_Message.h"
#include "JME_RpcClient.h"
#include "JME_RpcServer.h"
#include "JME_ServerInterface.h"
#include "JME_DBPool.h"
#include "JME_Singleton.h"
#include "JME_MongoConnection.h"

USING_NAMESPACE_JMENGINE;
USING_NAMESPACE_JMENGINE_NET;
USING_NAMESPACE_JMENGINE_GAME;
USING_NAMESPACE_JMENGINE_RPC;
USING_NAMESPACE_JMENGINE_DB;

typedef DBHelper<JME_MongoConnection> MongodbConnHelper;
typedef DBPool<JME_MongoConnection>	MongoDBPool;

static bool connectMongoDB(JME_MongoConnection* conn, const string& ip_str, const string& db_name, const string& name, const string& pwd);

class GameServer : 
	public JME_ServerInterface
{
public:
	typedef boost::shared_ptr<GameServer> GateServerPtr;
public:
	GameServer();
	~GameServer();

	static GameServer::GateServerPtr getInstance();

	MongoDBPool* getMongoDBPool();

private:
	void init();

private:
	MongoDBPool::DBPoolPtr _mongoDBPool;
};
#endif // GameServer_h__